CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
PROJECT(TaoismShare VERSION 0.1)

set(CMAKE_C_STANDARD 99)
message(STATUS "Current Platform: ${CMAKE_SYSTEM_NAME}")

# for debug macro
add_definitions(-DT_DEBUG)

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
    # cross compiler
    #set(TOOLCHAIN_PREFIX "arm-linux-gnueabihf-")
    set(CMAKE_C_COMPILER "${TOOLCHAIN_PREFIX}gcc")
    set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PREFIX}g++")
    set(CMAKE_CXX_FLAGS "-g -Wall -fPIC -O2")
    set(CMAKE_C_FLAGS "-g -Wall -fPIC -O2")
    add_link_options(-rdynamic)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
    set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
endif()

# add sub CMakelists.txt
ADD_SUBDIRECTORY(libsrc)
ADD_SUBDIRECTORY(application)
